import './index.scss'
import {Button, View, Image} from '@tarojs/components'
import {observer} from 'mobx-react'
import {useEffect} from 'react'
import Taro, {useDidHide, useDidShow} from '@tarojs/taro'
import {iconUrl} from '@/utils/baseUrl'
import {toHome} from '@/utils/pageRedirect'

const Binddeverror = () => {
  // 可以使用所有的 React Hooks
  useEffect(() => {
    console.log('Binddevsuccess useEffect')
    Taro.showModal({
      title: '设备绑定失败',
      content: '是否返回首页？',
      success(result) {
        if (result.confirm) {
          toHome()
        }
      }
    })
  }, [])
  // 对应 onShow
  useDidShow(() => {
    console.log('Binddevsuccess useDidShow')
  })
  // 对应 onHide
  useDidHide(() => {
    console.log('Binddevsuccess useDidHide')
  })
  return (
    <View className="h-screen bg-x_bg overflow-hidden">
      <Image
        src={iconUrl('bindDevError.png')}
        className="block w-228 mx-auto"
      ></Image>

      <Button
        className="block w-130 h-48 mx-auto mt-26 bg-danger rounded-8 text-white"
        onClick={toHome}
      >
        返回首页
      </Button>
    </View>
  )
}
export default observer(Binddeverror)
